#include <ListBoxPeople.h>

ListBoxPeople::ListBoxPeople()
{

}

void ListBoxPeople::formatOutput(std::ostream& os, PeopleData& peopleData)
{
	os<<peopleData.getName()<<'\t';
	FormatRadioButton* pFmtRadioButton;
	Format& Format_m = pFmtRadioButton->getSelectedFormat();
	peopleData.getLength().formatOutput(os, Format_m);
}

void ListBoxPeople::display(std::ostream& os)
{
	for(PeopleVector::size_type index=0;index != peopleVector_m.size();++index)
	{
		formatOutput(os, peopleVector_m[index]);
		OutputLineTerminal(os,index);
	}
}

void ListBoxPeople::OutputLineTerminal(std::ostream& os,PeopleVector::size_type index)
{
	if(index != peopleVector_m.size()-1)
		os<<'\n';
}

void ListBoxPeople::addPeople(PeopleData& peopleData)
{
	peopleVector_m.push_back(peopleData);
}
